package util
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	
	import asset.map;

	public class ScalerSprite extends Sprite
	{
		private var _scaler:map;

		private var _bounds:Rectangle;

		public function ScalerSprite()
		{
			super();
			_scaler=new map();
			_scaler.x=920;
			_scaler.y=20;

			this.addChild(_scaler);

			_bounds=new Rectangle(_scaler.btnDrag.x, _scaler.btnDrag.y, 0, _scaler.mc.height-32);

			init();
		}

		private function init():void
		{


			_scaler.btnDown.addEventListener(MouseEvent.CLICK, onDown, false, 0, true);
			_scaler.btnUp.addEventListener(MouseEvent.CLICK, onUp, false, 0, true);
			_scaler.btnDrag.addEventListener(MouseEvent.MOUSE_DOWN, onDrag, false, 0, true);
			_scaler.btnDrag.addEventListener(MouseEvent.MOUSE_UP, onStopDrag, false, 0, true);

		}

		private function onDown(e:MouseEvent):void
		{
			trace("goon");
		}

		private function onUp(e:MouseEvent):void
		{
			trace("123");

		}

		private function onDrag(e:MouseEvent):void
		{
			_scaler.btnDrag.startDrag(false, _bounds);
		}
		private function onStopDrag(e:MouseEvent):void
		{
			_scaler.btnDrag.stopDrag();
		}
	}
}
